<?php

/*
|--------------------------------------------------------------------------
| Routes File
|--------------------------------------------------------------------------
|
| Here is where you will register all of the routes in an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

Route::get('/', function () {
    return view('welcome');
});

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| This route group applies the "web" middleware group to every route
| it contains. The "web" middleware group is defined in your HTTP
| kernel and includes session state, CSRF protection, and more.
|
*/

Route::group(['middleware' => ['web']], function () {

    Route::get('menu',['as' => 'Home.Page.menu', 'uses' => 'HomeController@menu']);
    Route::get('content',['as' => 'Home.Page.content', 'uses' => 'HomeController@content']);
    Route::get('shareImg',['as' => 'Home.Page.shareImg', 'uses' => 'HomeController@shareImg']);

    Route::group(['prefix'=>'admin'],function(){
        Route::get('login',['as' => 'Admin.Home.login', 'uses' => 'AdminController@login']);
        Route::get('user-list',['as' => 'Admin.Home.userList', 'uses' => 'AdminController@userList']);
        Route::get('user-vip-list',['as' => 'Admin.Home.userVipList', 'uses' => 'AdminController@userVipList']);
        Route::get('banner-list',['as' => 'Admin.Home.bannerList', 'uses' => 'AdminController@bannerList']);
        Route::get('banner-set',['as' => 'Admin.Home.bannerSet', 'uses' => 'AdminController@bannerSet']);
        Route::get('change-Pwd',['as' => 'Admin.Home.changePwd', 'uses' => 'AdminController@changePwd']);
        Route::get('admin-list',['as' => 'Admin.Home.adminList' , 'uses' => 'AdminController@adminList']);
        Route::get('admin-set',['as' => 'Admin.Home.adminSet' , 'uses' => 'AdminController@adminSet']);
        Route::get('books-word-list',['as' => 'Admin.Home.booksWordList' , 'uses' => 'AdminController@booksWordList']);
        Route::get('books-word-set',['as' => 'Admin.Home.booksWordSet' , 'uses' => 'AdminController@booksWordSet']);
        Route::get('books-chapter-list',['as' => 'Admin.Home.booksChapterList' , 'uses' => 'AdminController@booksChapterList']);
        Route::get('books-chapter-set',['as' => 'Admin.Home.booksChapterSet' , 'uses' => 'AdminController@booksChapterSet']);
        Route::get('recharge-package-list',['as' => 'Admin.Home.rechargePackageList' , 'uses' => 'AdminController@rechargePackageList']);
        Route::get('recharge-package-set',['as' => 'Admin.Home.rechargePackageSet' , 'uses' => 'AdminController@rechargePackageSet']);
        Route::get('recharge-list',['as' => 'Admin.Home.rechargeList' , 'uses' => 'AdminController@rechargeList']);
        Route::get('vip-buy-list',['as' => 'Admin.Home.vipBuyList' , 'uses' => 'AdminController@vipBuyList']);
        Route::get('buy-book-list',['as' => 'Admin.Home.buyBookList' , 'uses' => 'AdminController@buyBookList']);
        Route::get('income-count-list',['as' => 'Admin.Home.incomeCountList' , 'uses' => 'AdminController@incomeCountList']);
        Route::get('classify-list',['as' => 'Admin.Home.classifyList' , 'uses' => 'AdminController@classifyList']);
        Route::get('vip-rule-list',['as' => 'Admin.Home.vipRuleList' , 'uses' => 'AdminController@vipRuleList']);
        Route::get('package-rule-list',['as' => 'Admin.Home.packageRuleList' , 'uses' => 'AdminController@packageRuleList']);


    });

    Route::group(['prefix'=>'api', 'namespace'=>'Api','middleware' => ['cors']],function(){
        Route::group(['prefix' => 'admin','namespace'=>'Admin'],function(){
            Route::post('auth/sign-in',['as'=>'Api.Admin.Auth.signInAdmin','uses'=>'AuthController@signInAdmin']);
            Route::post('auth/change-pwd',['as'=>'Api.Admin.Auth.changePassword','uses'=>'AuthController@changePassword']);
            Route::get('auth/signOut',['as'=>'Api.Admin.Auth.signOut','uses'=>'AuthController@signOut']);
            Route::post('sys/setBanner',['as'=>'Api.Admin.sys.setBanner','uses'=>'SystemController@setBanner']);
            Route::post('sys/delBanner',['as'=>'Api.Admin.sys.delBanner','uses'=>'SystemController@delBanner']);
            Route::post('sys/setAdmin',['as' => 'Api.Admin.sys.setAdmin','uses' => 'SystemController@setAdmin']);
            Route::post('sys/delAdmin',['as'=>'Api.Admin.sys.delAdmin','uses'=>'SystemController@delAdmin']);
            Route::post('sys/setBooksWord',['as' => 'Api.Admin.sys.setBooksWord','uses' => 'SystemController@setBooksWord']);
            Route::post('sys/delBooksWord',['as' => 'Api.Admin.sys.delBooksWord','uses' => 'SystemController@delBooksWord']);
            Route::post('sys/setBooksChapter',['as' => 'Api.Admin.sys.setBooksChapter','uses' => 'SystemController@setBooksChapter']);
            Route::post('sys/delBooksChapter',['as' => 'Api.Admin.sys.delBooksChapter','uses' => 'SystemController@delBooksChapter']);
            Route::post('sys/setRechargePackage',['as' => 'Api.Admin.sys.setRechargePackage','uses' => 'SystemController@setRechargePackage']);
            Route::post('sys/delRechargePackage',['as' => 'Api.Admin.sys.delRechargePackage','uses' => 'SystemController@delRechargePackage']);
            Route::post('sys/addClassify',['as'=>'Api.Admin.sys.addClassify','uses'=>'SystemController@addClassify']);
            Route::post('sys/delClassify',['as'=>'Api.Admin.sys.delClassify','uses'=>'SystemController@delClassify']);
            Route::post('sys/setUserFree',['as'=>'Api.Admin.sys.setUserFree','uses'=>'SystemController@setUserFree']);
            Route::post('sys/setVipRule',['as'=>'Api.Admin.sys.setVipRule','uses'=>'SystemController@setVipRule']);
            Route::post('sys/delVipRule',['as'=>'Api.Admin.sys.delVipRule','uses'=>'SystemController@delVipRule']);
            Route::post('sys/setPackageRule',['as'=>'Api.Admin.sys.setPackageRule','uses'=>'SystemController@setPackageRule']);
            Route::post('sys/delPackageRule',['as'=>'Api.Admin.sys.delPackageRule','uses'=>'SystemController@delPackageRule']);
            Route::post('sys/setUserVip',['as'=>'Api.Admin.sys.setUserVip','uses'=>'SystemController@setUserVip']);
            Route::post('sys/delUserVip',['as'=>'Api.Admin.sys.delUserVip','uses'=>'SystemController@delUserVip']);
        });

        Route::group(['prefix' => 'wx'],function(){
            Route::any('getJsApiPacket',['as'=>'Api.Wechat.getJsApiPacket','uses'=>'WechatController@getJsApiPacket']);
        });

        Route::group(['prefix' => 'file'],function(){
            Route::post('upload-img',['as'=>'Api.File.upload','uses'=>'ImageController@upload']);
            Route::post('upload-audio',['as'=>'Api.File.uploadAudio','uses'=>'ImageController@uploadAudio']);
            Route::get('show-image/{id}',['as'=>'Api.File.showImageById','uses'=>'ImageController@showImageById']);
            Route::get('reloadImages',['as'=>'Api.File.reloadImages','uses'=>'ImageController@reloadImages']);
            Route::post('uploadBase64Image',['as'=>'Api.File.uploadBase64Image','uses'=>'ImageController@uploadBase64Image']);
            Route::post('upload-user-photo',['as'=>'Api.File.uploadUserPhoto','uses'=>'ImageController@uploadUserPhoto']);
        });

        Route::group(['prefix' => 'audio'],function(){
            Route::get('upload-audio/{audio_id}',['as'=>'Api.Audio.getAudioUrl','uses'=>'AudioController@getAudioUrl']);
       });

        Route::group(['prefix' => 'auth'],function(){
            Route::get('wxLogin',['as'=>'Api.Auth.wxLogin','uses'=>'AuthController@wxLogin']);
            Route::get('goToUrl',['as'=>'Api.Auth.goToUrl','uses'=>'AuthController@goToUrl']);
            Route::any('wechatCallback',['as'=>'Api.Auth.wechatCallback','uses'=>'AuthController@wechatCallback']);
        });

        Route::group(['prefix' => 'payment'],function(){
            Route::post('weChatPayment',['as'=>'Api.Payment.weChatPayment','uses'=>'PaymentController@weChatPayment']);
            Route::any('WeChatPayCallback',['as'=>'Api.Payment.WeChatPayCallback','uses'=>'PaymentController@WeChatPayCallback']);
            Route::post('booksBuy',['as'=>'Api.Payment.booksBuy','uses'=>'PaymentController@booksBuy']);
            Route::post('WxCompanyPayment',['as'=>'Api.Payment.WxCompanyPayment','uses'=>'PaymentController@WxCompanyPayment']);
        });

        Route::group(['prefix' => 'order'],function(){
            Route::post('buildOrder',['as'=>'Api.Order.WeChatPayCallback','uses'=>'OrderController@buildOrder']);
        });

        Route::group(['prefix' => 'ucenter'],function(){
            Route::get('getUserInfo',['as'=>'Api.UCenter.getUserInfo','uses'=>'UCenterController@getUserInfo']);
            Route::get('getRechargePackage',['as'=>'Api.UCenter.getRechargePackage','uses'=>'UCenterController@getRechargePackage']);
            Route::get('getUserBooksList',['as'=>'Api.UCenter.getUserBooksList','uses'=>'UCenterController@getUserBooksList']);
            Route::get('getRecentlyReadList',['as'=>'Api.UCenter.getRecentlyReadList','uses'=>'UCenterController@getRecentlyReadList']);
            Route::get('userSpendRecord',['as'=>'Api.UCenter.userSpendRecord','uses'=>'UCenterController@userSpendRecord']);
            Route::get('getUserReadingRecord',['as'=>'Api.UCenter.getUserReadingRecord','uses'=>'UCenterController@getUserReadingRecord']);
            Route::post('delReadingRecord',['as'=>'Api.UCenter.delReadingRecord','uses'=>'UCenterController@delReadingRecord']);
            Route::get('orderList',['as'=>'Api.UCenter.orderList','uses'=>'UCenterController@orderList']);
            Route::get('getUserBalanceDetails',['as'=>'Api.UCenter.getUserBalanceDetails','uses'=>'UCenterController@getUserBalanceDetails']);
            Route::get('getMyShareImg',['as'=>'Api.UCenter.getMyShareImg','uses'=>'UCenterController@getMyShareImg']);

        });

        Route::group(['prefix' => 'books'],function(){
            Route::get('getBooksInfoList',['as'=>'Api.Books.getBooksInfoList','uses'=>'BooksController@getBooksInfoList']);
            Route::get('getBooksChapterList',['as'=>'Api.Books.getBooksChapterList','uses'=>'BooksController@getBooksChapterList']);
            Route::get('getBooksChapterContent',['as'=>'Api.Books.getBooksChapterContent','uses'=>'BooksController@getBooksChapterContent']);
            Route::post('saveReadingRecord',['as'=>'Api.Books.saveReadingRecord','uses'=>'BooksController@saveReadingRecord']);
            Route::get('getClassify',['as'=>'Api.Books.getClassify','uses'=>'BooksController@getClassify']);

        });

        Route::group(['prefix' => 'other'],function(){
            Route::get('getBannerList',['as'=>'Api.Order.getBannerList','uses'=>'OtherController@getBannerList']);
            Route::get('getVipList',['as'=>'Api.Order.getVipList','uses'=>'OtherController@getVipList']);
        });

        Route::group(['prefix' => 'distribution'],function(){
            Route::post('wxShare',['as'=>'Api.distribution.wxShare','uses'=>'DistributionController@wxShare']);
            Route::get('inviteUserList',['as'=>'Api.distribution.inviteUserList','uses'=>'DistributionController@inviteUserList']);
        });
    });
});
